﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XcoAppSpaces.Contracts.Service;

namespace test.XcoAppSpaces.Core.Configuration.TestInterpreters
{
	class TestInterpreter1 : XcoConfigStringInterpreterBase
	{
		private bool keyPresent = false;

		public override IXcoService GetService
		{
			get { return (keyPresent ? new TestService1() : null); }
		}

		public override Dictionary<string, Action<string>> InterpretDefinition
		{
			get 
			{ 
				return new Dictionary<string, Action<string>>
			             	{
			             		{ "test1.key1", v => { Console.WriteLine("TestInterpreter1 Key1 called with value " + v);
			             		                     	keyPresent = true;} },
								{ "test1.key2", v => { Console.WriteLine("TestInterpreter1 Key2 called with value " + v);
								                     	keyPresent = true;} }
			             	}; 
			}
		}
	}

	class TestService1 : IXcoService
	{

		#region IXcoService Members

		public void Initialize(IXcoServiceRegistry serviceRegistry)
		{
		}

		#endregion
	}
}
